/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
 */

package com.xjw.entity;

import lombok.Data;

import java.util.Objects;

/**
 * @author xwx1052336
 * @since 2021/10/15
 */
@Data
public class IntNum {

    private int num;

    @Override
    public boolean equals(Object o) {
        if(o instanceof Integer){
            return Integer.parseInt(o.toString()) == num;
        }
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        IntNum intNum = (IntNum) o;
        return num == intNum.num;
    }

    public int add() {
        return ++num;
    }

    @Override
    public int hashCode() {
        return Objects.hash(num);
    }

    public IntNum() { }

    public IntNum(int num){
        this.num = num;
    }

}
